﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Data;
using System.Data.SqlClient;
using System.Text;
using System.Threading.Tasks;

namespace 小次郎点餐系统
{
    class DBHelper
    {
        public static string cstring = "Data Source=.;Initial Catalog=order system;Integrated Security=True";
        public static DataTable read(string sql)
        {
            SqlConnection conn = new SqlConnection(cstring);
            SqlDataAdapter data = new SqlDataAdapter(sql,conn);
            DataTable table = new DataTable();
            data.Fill(table);
            return table;
        }
        public static int write(string sql)
        {
            SqlConnection conn = new SqlConnection(cstring);
            conn.Open();
            SqlCommand cmd = new SqlCommand(sql,conn);
            int rs = cmd.ExecuteNonQuery();
            conn.Close();
            return rs;
        }
    }
}
